﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace BrandonHaynes.Data
	{
	class Program
		{
		static void Main()
			{
			var reader = GetSampleReader();

			while(reader.Read())
				{
				Console.WriteLine("SampleId: " + reader["SampleId"]);
				Console.WriteLine("Name: " + reader["Name"]);
				Console.WriteLine("Data: " + reader["Data"]);
				Console.WriteLine("ParentId: " + reader["ParentId"]);
				Console.WriteLine("---------------------");
				}

			Console.WriteLine("Done!");
			Console.ReadKey();
			}

		static IDataReader GetSampleReader()
			{
			using (var context = new SampleModel())
				{
				return new DataReaders.SampleDataReader(context.Sample
					.Include("Parent")
					.Where(sample => sample.Parent.ParentId!= 2));
				}
			}
		}
	}
